/*
 * @Description: 批量导入文件
 * @Author: wangqi
 * @Date: 2022-04-20 17:10:59
 * @LastEditTime: 2022-04-21 11:01:22
 */

// generate components map
export const asyncRouterComponents = {};

// auto load
const modulesFiles = import.meta.globEager('./**/*.ts');
console.log(modulesFiles, 'modulesFiles');

Object.keys(modulesFiles).forEach((path) => {
  if (path.startsWith('./index.')) return;
  const value = modulesFiles[path].default;

  // mouted
  Object.keys(value).forEach((ele) => {
    asyncRouterComponents[ele] = value[ele];
  });
});

console.log('asyncRouterComponents', asyncRouterComponents);
